﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendInfo.aspx.cs" Inherits="Workflow.SendInfo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <table class="table table-bordered table-hover definewidth m10">
            <thead>
                <tr>
                    <th>推送到</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <% for (int i = 0; i < resultList.Count; i++) %>
                <% { %>
                    <tr>
                        <td class="tableleft"><label class="lblName"><%=resultList[i].NodeName %></label></td>
                        <td>
                            <select id="<%= i%>" class="SelectUser">
                            </select>
                        </td>
                    </tr>
                <% } %>
            </tbody>
            <tr>
                <td class="tableleft"></td>
                <td>
                    <button id="Btn1" class="btn btn-primary">提交</button>
                </td>
            </tr>
        </table>
    </div>
    </form>
    <script>
        $(document).ready(function () {
           <% for(int i=0;i<resultList.Count;i++){%>
            var url = "Server.ashx?Type=Submit&TeamId=<%=resultList[i].TeamId%>&RoleId=<%=resultList[i].RoleId%>&WorkMouldId=<%=resultList[i].WorkMouldId%>";
                $.ajax({
                    type: "Get",
                    url: url,
                    success: function (data) {
                        var person = $.parseJSON(data);
                        for (var j = 0; j < person.length; j++) {
                            //alert(person[j].DisplayName);
                            var thBody = "";
                            thBody += "<option value=" + person[j].UserName + ">" + person[j].DisplayName + "</option>";
                            $("#<%=i%>").append(thBody);
                        }
                        //alert(data);
                    }

                });
            <%}%>
            return false;
        });
    </script>
    <script>
        $(document).ready(function () {
            $("#Btn1").click(function () {
                $(this).attr("disabled", "true");
                $("select").each(function (i, e) {
                    var sId = $(this).attr("id");
                    var sValue = $("#" + sId).val();
                    var childNo = parseInt(sId)+1;
                    var url = "Server.ashx?Type=Send&WorkParentId=<%=workParentId %>&NodeNo=<%=nextNodeNo %>&ChildNo=" + childNo + "&UserName=" + sValue;
                    //alert(url);
                    $.ajax({
                        type: "Get",
                        url: url,
                        success: function (data) {
                            alert('提交成功！')
                            window.opener.location.reload();
                            window.close();
                        }
                    });
                });
                return false;
            });
        });
    </script>
</body>
</html>
